/****************************************************************************
** Image collection for project 'buttons'.
**
** Generated from reading image files: 
**      pics/attach.png
**      pics/detach.png
**
** Created: Fri Jul 28 15:14:25 2006
**      by: The User Interface Compiler ($Id: qt/embed.cpp   3.3.6   edited Aug 31 2005 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include <qimage.h>
#include <qdict.h>
#include <qmime.h>
#include <qdragobject.h>

// pics/attach.png
static const unsigned char image_0_data[] = {
    0x00,0x00,0x01,0x00,0x78,0x9c,0x63,0x60,0x60,0xf8,0xcf,0x40,0x18,0x90,
    0xab,0x06,0x5d,0x8c,0x10,0x1f,0x5d,0x0c,0x97,0xbd,0xff,0x09,0xc8,0xc3,
    0xe4,0xd0,0xcd,0xc2,0xc0,0x00,0x19,0x3c,0x11,0xef
};

// pics/detach.png
static const unsigned char image_1_data[] = {
    0x00,0x00,0x01,0x00,0x78,0x9c,0x63,0x60,0x60,0xf8,0xcf,0x80,0x1d,0xc3,
    0x00,0x3a,0x1f,0x1d,0xfc,0x47,0xa3,0x71,0xc9,0xe3,0x52,0x83,0x2e,0x46,
    0x88,0x8f,0xcf,0x2e,0x92,0xd5,0x00,0x00,0xb3,0xe7,0x11,0xef
};

static struct EmbedImage {
    int width, height, depth;
    const unsigned char *data;
    ulong compressed;
    int numColors;
    const QRgb *colorTable;
    bool alpha;
    const char *name;
} embed_image_vec[] = {
    { 8, 8, 32, (const unsigned char*)image_0_data, 38, 0, 0, TRUE, "attach.png" },
    { 8, 8, 32, (const unsigned char*)image_1_data, 40, 0, 0, TRUE, "detach.png" },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

static QImage uic_findImage( const QString& name )
{
    for ( int i=0; embed_image_vec[i].data; i++ ) {
	if ( QString::fromUtf8(embed_image_vec[i].name) == name ) {
	    QByteArray baunzip;
	    baunzip = qUncompress( embed_image_vec[i].data, 
		embed_image_vec[i].compressed );
	    QImage img((uchar*)baunzip.data(),
			embed_image_vec[i].width,
			embed_image_vec[i].height,
			embed_image_vec[i].depth,
			(QRgb*)embed_image_vec[i].colorTable,
			embed_image_vec[i].numColors,
			QImage::BigEndian
		);
	    img = img.copy();
	    if ( embed_image_vec[i].alpha )
		img.setAlphaBuffer(TRUE);
	    return img;
        }
    }
    return QImage();
}

class MimeSourceFactory_buttons : public QMimeSourceFactory
{
public:
    MimeSourceFactory_buttons() {}
    ~MimeSourceFactory_buttons() {}
    const QMimeSource* data( const QString& abs_name ) const {
	const QMimeSource* d = QMimeSourceFactory::data( abs_name );
	if ( d || abs_name.isNull() ) return d;
	QImage img = uic_findImage( abs_name );
	if ( !img.isNull() )
	    ((QMimeSourceFactory*)this)->setImage( abs_name, img );
	return QMimeSourceFactory::data( abs_name );
    };
};

static QMimeSourceFactory* factory = 0;

void qInitImages_buttons()
{
    if ( !factory ) {
	factory = new MimeSourceFactory_buttons;
	QMimeSourceFactory::defaultFactory()->addFactory( factory );
    }
}

void qCleanupImages_buttons()
{
    if ( factory ) {
	QMimeSourceFactory::defaultFactory()->removeFactory( factory );
	delete factory;
	factory = 0;
    }
}

class StaticInitImages_buttons
{
public:
    StaticInitImages_buttons() { qInitImages_buttons(); }
#if defined(Q_OS_SCO) || defined(Q_OS_UNIXWARE)
    ~StaticInitImages_buttons() { }
#else
    ~StaticInitImages_buttons() { qCleanupImages_buttons(); }
#endif
};

static StaticInitImages_buttons staticImages;
